<template>
  <el-table :data="shopCarData" stripe style="width: 100%">

    <el-table-column prop="movieName" label="商品名称"/>
    <el-table-column prop="movieCode" label="商品编号"/>
    <el-table-column prop="price" label="价格"/>
    <el-table-column prop="num" label="数量"/>
    <el-table-column prop="buyDate" label="购买时间"/>

    <!--    <el-table-column label="商品数量">-->
    <!--      <template #default="scope">-->
    <!--        <el-input v-model="scope.row.goodsNumber" @change="update(scope.row)"></el-input>-->
    <!--      </template>-->
    <!--    </el-table-column>-->
    <el-table-column label="操作">
      <template #default="scope">
        <el-button type="danger" @click="rmv(scope.row.goodsCode)">删除</el-button>
      </template>
    </el-table-column>
  </el-table>
  <el-button type="primary" @click="this.$router.push('index')">回到商品页</el-button>
</template>

<script>
import axios from "axios";
import {ElMessage} from "element-plus";

export default {
  name: "shopCar",
  created() {
    this.initData();
  },
  data() {
    return {
      shopCarData: [],
    }
  },
  methods: {
    initData() {
      let param = {
        currentPage: 1,
        pageSize: 20,
        data: sessionStorage.getItem("user")
      }
      axios.post('apc/order/pageFindAllOrder', param).then(p => {
        this.shopCarData = p.data.content;
      })
    },
    update(row) {
      axios.post('api/shopCar/update', row).then(p => {
        ElMessage({message: "更新成功", type: "success"})
      })
    },
    // rmv(goodsCode){
    //   axios.get('api/shopCar/delete?goodsCode='+goodsCode).then(p=>{
    //     this.initData();
    //   })
    // }
  }
}
</script>

<style scoped>

</style>